;;; --------------------------------------------------------------------------;
;;; FPRINT.LSP
;;;   Copyright (C) 1990 by Autodesk, Inc.
;;;  
;;;   Permission to use, copy, modify, and distribute this software and its
;;;   documentation for any purpose and without fee is hereby granted.  
;;;
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 
;;;   ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF 
;;;   MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;; --------------------------------------------------------------------------;
;;; DESCRIPTION
;;;
;;;   This is a programming example.
;;;
;;;   This function prints (lists) an ASCII text file on the screen.
;;;
;;;   Usage:   (fprint "filename.ext")
;;;
;;; --------------------------------------------------------------------------;

(defun fprint (s / c i) 
  (setq i (open s "r"))               ; open the file for reading
  (if i 
    (progn
      (while (setq c (read-line i))   ; read one line of text from the file
        (princ c)                     ; and print it on the screen
        (princ "\n")
      ) 
      (close i)                       ; close the file
    ) 
    (princ (strcat "Cannot open file " s))
  ) 
  (princ)
) 

;;; --------------------------------------------------------------------------;

